
    <!DOCTYPE html>
    <html lang="zh-CN">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>SpringBean生命周期 - 学习卡片</title>
      <style>
        body { font-family: sans-serif; background-color: #f0f8ff; color: #333; display: flex; flex-direction: column; align-items: center; padding: 50px 20px; }
        .header h1 { font-size: 32px; }
        .grid-container { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; width: 100%; max-width: 1200px; }
        .card-container { perspective: 1200px; cursor: pointer; height: 250px; }
        .card { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform 0.7s; border-radius: 16px; box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
        .card-container.flipped .card { transform: rotateY(180deg); }
        .card-face { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; display: flex; flex-direction: column; box-sizing: border-box; border-radius: 16px; background-color: #fff; padding: 24px; }
        .card-back { background-color: #f0fff4; transform: rotateY(180deg); justify-content: space-between; }
        .card-category { font-size: 14px; color: #0052d9; margin-bottom: 8px; font-weight: 500; }
        .card-question { font-size: 20px; font-weight: 500; flex-grow: 1; display: flex; align-items: center; justify-content: center; text-align: center; }
        .card-answer-wrapper { flex-grow: 1; overflow-y: auto; }
        .card-answer { font-size: 15px; line-height: 1.7; }
        .card-footer { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 16px; margin-top: 16px; }
        .card-source { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 12px; margin-top: 12px; }
      </style>
    </head>
    <body>
      <div class="header">
        <h1>SpringBean生命周期 - 学习卡片</h1>
      </div>
      <div class="grid-container">
        
    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">理论</div>
          <div class="card-question">在Spring框架中，什么是“Bean”？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">理论</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">在Spring中，由Spring IoC容器管理的、构成应用程序主干的对象称为Bean。Bean是由Spring IoC容器负责实例化、组装和管理的对象。通俗来讲，Bean就是我们编写的Java类。</div>
          </div>
          <div class="card-source">来源: 什么是 Bean</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">Spring Bean的初始化流程包含哪四个主要阶段？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">Spring Bean的初始化流程主要包括四个阶段：1. 实例化 (Instantiation)，即调用构造器创建对象；2. 属性赋值 (Populate)，即进行依赖注入；3. 初始化 (Initialization)，例如调用init方法；4. 销毁 (Destruction)，当容器关闭时执行。</div>
          </div>
          <div class="card-source">来源: Spring Bean初始化的流程</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">理论</div>
          <div class="card-question">普通Java对象的生命周期与Spring Bean的生命周期有何不同？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">理论</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">普通Java对象的生命周期相对简单，主要包括实例化和在不再被使用时由垃圾回收机制回收。而Spring Bean的生命周期则由Spring IoC容器管理，经历实例化、属性赋值、初始化和销毁等一系列精确控制的阶段。</div>
          </div>
          <div class="card-source">来源: 普通对象(Bean)的生命周期 和 Spring Bean初始化的流程</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">分类</div>
          <div class="card-question">Spring Bean的生命周期相关方法可以分为哪四大类？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">分类</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">Spring Bean的生命周期相关方法可分为四类：1. Bean自身的方法（如init-method/destroy-method）；2. Bean级生命周期接口的方法（如InitializingBean）；3. 容器生命周期方法（如BeanPostProcessor）；4. 工厂后处理器接口方法（如BeanFactoryPostProcessor）。</div>
          </div>
          <div class="card-source">来源: SpringBean生命周期函数分类</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">文档中提及了哪些Bean级的生命周期接口？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">文档中提及的Bean级生命周期接口包括：BeanNameAware、BeanFactoryAware、InitializingBean 和 DisposableBean。</div>
          </div>
          <div class="card-source">来源: Bean级生命周期的方法</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">BeanPostProcessor接口在Bean的生命周期中扮演什么角色？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">BeanPostProcessor接口属于容器级生命周期方法，它允许在Bean的初始化方法（如afterPropertiesSet或init-method）调用前后添加自定义逻辑。其实现类通常被称为“后处理器”。</div>
          </div>
          <div class="card-source">来源: 容器生命周期方法 和 2、BeanPostProcessor接口的方法</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">BeanFactoryPostProcessor的作用是什么，它在何时被调用？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">BeanFactoryPostProcessor是一个工厂后处理器接口，它允许在应用上下文装配配置文件之后、任何Bean实例化之前对容器的配置元数据进行修改。例如，可以通过它来修改某个Bean的属性值。</div>
          </div>
          <div class="card-source">来源: 工厂后处理器接口方 和 4、后置处理器接口方法</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">Spring容器是如何销毁Bean的？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">当Spring容器关闭时，会通过调用`ConfigurableApplicationContext#close()`方法来销毁由它管理的对象（Bean），触发Bean的销毁流程。</div>
          </div>
          <div class="card-source">来源: Spring Bean初始化的流程</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">在Spring容器的`refresh()`核心方法中，哪一步是用来实例化所有非懒加载的单例Bean的？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">在`refresh()`方法中，`finishBeanFactoryInitialization(beanFactory)`这一步负责实例化所有剩余的（非懒加载）单例Bean，在此过程中，各种BeanPostProcessor开始发挥作用。</div>
          </div>
          <div class="card-source">来源: SpringBean生命周期源码演示</div>
        </div>
      </div>
    </div>

      </div>
    </body>
    </html>
